<?php

namespace App\Livewire;

use App\ViewModels\ConnectionsViewModel;
use Livewire\Attributes\Computed;
use Livewire\Component;

class ConnectionInputForm extends Component
{
    public $connectionName;

    public $user;

    public $server_ip;

    public function mount($connectionName, $user, $server_ip)
    {
        $this->connectionName = $connectionName;
        $this->user = $user;
        $this->server_ip = $server_ip;
    }

    #[Computed()]
    public function connectionField()
    {
        return ConnectionsViewModel::make()->getAllConnectionRulesByName($this->connectionName);
    }

    public function render()
    {
        return view('livewire.server.connection-input-form');
    }
}
